<template>
    <div class>
    <el-card class="ep-card ep-search">
            <el-row :gutter="0">
                <el-col :span="3" style="float:right">
                <el-button type="primary"  @click="back">返回</el-button>
                </el-col>
                <el-col :span="2" style="float:right">
                    <el-button type="success"  @click="submit">保存</el-button>
                  </el-col>
            </el-row>
     </el-card>
      <el-tabs type="border-card">
        <el-tab-pane label="基本信息">
          <entBaseComponentDisplay ref="entBaseComponentDisplay"></entBaseComponentDisplay>
          <el-divider content-position="left">工商注册信息</el-divider>
            <entBaseGsComponentDisplay ref="entBaseGsComponentDisplay"></entBaseGsComponentDisplay>
        </el-tab-pane>
        <el-tab-pane label="人员信息">
          <entpersonComponentDisplay ref="entpersonComponentDisplay"></entpersonComponentDisplay>
        </el-tab-pane>
        <el-tab-pane label="项目信息">
          <projApplyComponent ref="projApplyComponent"></projApplyComponent>
        </el-tab-pane>
      </el-tabs>
    </div>
  </template>
  
  <script>
  export default {
    components: {
        entBaseComponentDisplay: require("@/pages/biz/ent/entDisplay/entBaseComponentDisplay.vue").default,
        entBaseGsComponentDisplay: require("@/pages/biz/ent/entDisplay/entBaseGsComponentDisplay.vue").default,
        entpersonComponentDisplay: require("@/pages/biz/ent/entDisplay/entpersonComponentDisplay.vue").default,
        projApplyComponent: require("@/pages/biz/proj/projApply.vue").default,
    },
    data() {
      return {
        entId:'',
      };
    },
    computed: {},
    mounted() {
        if(this.$route.query.entId){
             this.entId=this.$route.query.entId;
        }else{
             this.entId="";
        }
        this.init();
    },
    methods: {
      back(){
        this.$router.push({path:"/ent/list"});
      },
      init() {
        //合作银行列表
        this.$refs.entBaseComponentDisplay.init(this.entId);
        //企业人员列表
        this.$refs.entBaseGsComponentDisplay.init(this.entId);
        //其他人员列表
        this.$refs.entpersonComponentDisplay.init(this.entId);
      },
      submit(){
        let projApply= this.$refs.projApplyComponent.getdata();
        let user=JSON.parse(sessionStorage.getItem("user"));
        projApply.createUserId=user.id;
        projApply.createUserName=user.realName;
        if(user.organCode){
          projApply.organCode=user.organCode;
        }
        if(user.organId){
          projApply.organId=user.organId;
        }
        if(user.organName){
          projApply.organName=user.organName;
        }
        projApply.entId=this.entId;
        this.$api.formPost( '/api/biz/projectApply/doSave',projApply).then(res => {
              if(res.retHead.code=="0000000"){
                    this.$message({
                        type: 'success',
                        message: "保存成功"
                    });
                }else{
                    this.$message({
                        type: 'error',
                        message: res.retHead.message
                    });
                }
            });
      }
    },
    created() {}
  };
  </script>
  <style lang='scss' scoped>
  </style>